/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ucm;

import javax.swing.JButton;
import model.IntersectionInfo;

/**
 * Use case control components class to handle end simulation button event.
 * @author Chiaki Sato
 * @since J2SDK 1.6
 * @version 1.0
 */
public class UCEndSimulationButton extends JButton implements UCController{

    private IntersectionInfo oIntersectionInfo;

    /**
     * Constructor of end simulation button class that initializes instance variables based on input parameters.
     * @param stText Control caption text
     * @param oIntersectionInfo Intersection information object
     */
    public UCEndSimulationButton(String stText, IntersectionInfo oIntersectionInfo) {

        super(stText);
        this.oIntersectionInfo = oIntersectionInfo;
    }

    /**
     * Public run function to execute a process of the end simulation button.
     */
    public void run() {

        // User clicks the end simulation button
        // System sets the traffic on going flag off to stop the traffic simulation
        oIntersectionInfo.setTafficOnGoing(false);
    }
}
